package com.situ.report.dao;

import com.situ.report.entity.gcservice;
import com.situ.util.entity.CstService;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Gcservicedao {
    @Select("<script>"+
            "select\n" +
            "\t\t<if test=\"aa==1\">case cust_level   when 3 then '大客户' when 4 then '重点开发客户' when 1 then '战略合作伙伴' when 2 then '合作伙伴' when 5 then '普通客户'end label, COUNT(cust_level) value from cst_customer group by cust_level order by cust_level desc</if>\n" +
            "\t\t<if test=\"aa==2\">case cust_credit when 1 then '☆' when 2 then '☆☆'when 3 then '☆☆☆'when 4 then '☆☆☆☆'when 5 then '☆☆☆☆☆'end label,COUNT(cust_credit) value from cst_customer group by cust_credit order by cust_credit desc\n</if>\n" +
            "\t\t<if test=\"aa==3\">case cust_satisfy when 1 then '☆' when 2 then '☆☆'when 3 then '☆☆☆'when 4 then '☆☆☆☆' when 5 then '☆☆☆☆☆'end label,COUNT(cust_satisfy) value from cst_customer group by cust_satisfy order by cust_satisfy desc</if>\n"+
            "</script>")
    public List<gcservice> selectcst_customergc(int aaa);

    @Select("select distinct DATENAME(YEAR,svr_create_date) year from cst_service order by DATENAME(YEAR,svr_create_date) desc")
    List<gcservice> queryyear();

    @Select("<script>"+
            "select svr_type label,COUNT(svr_type) value from  cst_service"+
            "<where>"+
            "<if test=\"years!=null and years!=''\">\n" +
            " and year(svr_create_date)=#{years}" +
            "  </if>\n" +
            "</where>"+
            "group by svr_type"+
            "</script>"
    )
    List<gcservice> queryserice(Integer years);
}
